<template>
  <el-container style="padding: 0px;">
    <el-main style="padding: 0px;">
      <el-card class="ShoppingTrolley">
        <div>
          <span>
            <el-alert
              type="success"
              show-icon
              :closable="false"
              class="ShoppingTrolley"
            >
              商品已成功加入购物车
            </el-alert>
          </span>
          <div>
            <!-- 商品购物车表格 -->
            <table cellspacing="10" v-for="fit in 1" :key="fit">
              <tr style="backgroud-color: red;">
                <td style="width: 1rem;">
                  <div class="demo-image">
                    <div class="block">
                      <el-image
                        style="width: 100px; height: 100px"
                        :src="url"
                      ></el-image>
                    </div>
                  </div>
                </td>
                <td style="width: 50%; text-align: left;">
                  <div style="margin-bottom: 1rem; font-size: 15px">
                    {{ productName }}
                  </div>
                  <div style=" color: #999999">
                    <span style=" padding-right: 1rem">
                      {{ parameter }}
                    </span>
                  </div>
                </td>
                <td>
                  <el-button
                    style="float: right; font-size: 16px; padding: 1rem;"
                    type="primary"
                    plain
                    @click="toAccounts"
                  >
                    去购物车结算
                  </el-button>
                  <el-button
                    style="float: right; font-size: 16px; padding: 1rem; margin-right: 1rem;"
                    type="primary"
                    plain
                  >
                    查看商品详情
                  </el-button>
                </td>
              </tr>
            </table>
          </div>
        </div>
      </el-card>

      <el-card style="margin-top: 1rem">
        <div>
          <div style=" border-bottom: solid 1px #eeeeee; padding-bottom: 1rem">
            <span style="width: 100%;">购买该商品的人还购买了: </span>
          </div>
          <div style="margin-top: 1rem;" v-for="item in 20" :key="item">
            <el-card
              style="width: 25%; float: left; margin-left: 6%; margin-bottom: 1rem; "
            >
              <!-- 其它商品内容 -->
              <div style="width: 100%; text-align: left;">
                <ul>
                  <li>
                    <div
                      style=" float: left; width 40%; margin-bottom: 1.5rem;"
                    >
                      <el-image
                        style="height: 100px; width: 100px;"
                        :src="url"
                      ></el-image>
                    </div>

                    <div
                      style="float: left; margin-top: 10px; margin-left: 25px; text-align: center"
                    >
                      <ul>
                        <li>
                          <p>
                            三星 27英寸大电视
                          </p>
                        </li>
                        <li>
                          <p>
                            ￥1399.00
                          </p>
                        </li>
                        <li>
                          <el-button
                            style="padding: 0.6rem; width:80%"
                            type="primary"
                            @click="addProduct"
                          >
                            加入购物车
                          </el-button>
                        </li>
                      </ul>
                    </div>
                  </li>
                </ul>
              </div>
            </el-card>
          </div>
        </div>
      </el-card>
    </el-main>
  </el-container>
</template>

<script>
const cityOptions = ["上海", "北京", "广州", "深圳"];
export default {
  data() {
    return {
      // 加入购物商品
      productName: "商品名称",
      parameter: "商品参数",
      // 表单数据
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
      shoppingGood: [{}],
      shoppingGoods: [{}],
      fits: ["fill", "contain", "cover", "none", "scale-down"],
      url:
        "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      checkAll: false,
      checkedCities: ["上海", "北京"],
      cities: cityOptions,
      isIndeterminate: true,
    };
  },
  methods: {
    handleCheckAllChange(val) {
      this.checkedCities = val ? cityOptions : [];
      this.isIndeterminate = false;
    },
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.cities.length;
      this.isIndeterminate =
        checkedCount > 0 && checkedCount < this.cities.length;
    },
    addProduct() {
      alert("加入购物车成功");
    },
    toAccounts(){
      this.$router.push('settle')
    }
  },
};
</script>

<style scoped>
* {
  padding: 0px;
  margin: 0px;
}
.ShoppingTrolley {
  background-color: rgb(247, 247, 247);
  font-size: 12px;
}
table {
  margin-top: 1rem;
  padding: 0px;
  width: 100%;
  /* border: solid 1px red; */
  /* background-color: aliceblue; */
  height: 0px;
  text-align: center;
}
tr td {
  /* border: solid 1px red; */
}
.el-card {
  margin: 0%;
}

.productList {
  margin-bottom: 1rem;
}
ul {
  list-style-type: none;
}
li {
  margin-bottom: 10px;
}
.text-ul {
  background-position-x: 15px;
}
</style>
